package view;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ComboBoxModel;
import javax.swing.DefaultComboBoxModel;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JLabel;

import javax.swing.WindowConstants;
import org.jdesktop.application.Action;
import org.jdesktop.application.Application;
import org.jdesktop.application.ApplicationActionMap;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class ProductoBusqueda extends javax.swing.JPanel {
	private JLabel jLabelProductoBuscar;
	private JComboBox jComboBoxProductoID;
	private JButton jButtonProductoCancelar;
	private JButton jButtonProductoAceptar;
	private static ProductoBusqueda frameProductoBusquedaInstancia;
	private ProductoModificacion frameProductoModificacion;
	private AbstractAction abstractActionProductoAceptar;

	
	public static ProductoBusqueda getInstancia(){
		if(frameProductoBusquedaInstancia==null){
			frameProductoBusquedaInstancia=new ProductoBusqueda();
		}
		return frameProductoBusquedaInstancia;
	}
	
	public ProductoBusqueda() {
		super();
		
		this.frameProductoModificacion = ProductoModificacion.getInstancia();
		this.frameProductoModificacion.setVisible(false);
		
		
		initGUI();
	}
	
	private void initGUI() {
		try {
			this.setLayout(null);
			{
				jLabelProductoBuscar = new JLabel();
				this.add(jLabelProductoBuscar);
				;
				jLabelProductoBuscar.setBounds(12, 12, 302, 16);
				jLabelProductoBuscar.setName("jLabelProductoBuscar");
			}
			{
				ComboBoxModel jComboBoxProductoIDModel = 
					new DefaultComboBoxModel(
							new String[] { "01 Pure de Tomate", "02 Pimienta" });
				jComboBoxProductoID = new JComboBox();
				this.add(jComboBoxProductoID);
				jComboBoxProductoID.setModel(jComboBoxProductoIDModel);
				jComboBoxProductoID.setBounds(100, 34, 168, 23);
			}
			{
				jButtonProductoAceptar = new JButton();
				this.add(jButtonProductoAceptar);
				jButtonProductoAceptar.setText("Aceptar");
				jButtonProductoAceptar.setBounds(86, 88, 95, 22);
				jButtonProductoAceptar.setAction(getAbstractActionProductoAceptar());
			}
			{
				jButtonProductoCancelar = new JButton();
				this.add(jButtonProductoCancelar);
				jButtonProductoCancelar.setText("Cancelar");
				jButtonProductoCancelar.setBounds(204, 87, 99, 23);
				jButtonProductoCancelar.setAction(getAppActionMap().get("actionCancelar"));
			}
			this.setSize(345, 159);
			Application.getInstance().getContext().getResourceMap(getClass()).injectComponents(this);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	private AbstractAction getAbstractActionProductoAceptar() {
		if(abstractActionProductoAceptar == null) {
			abstractActionProductoAceptar = new AbstractAction("Aceptar", null) {
				public void actionPerformed(ActionEvent evt) {
					frameProductoModificacion.setVisible(true);
				}
			};
		}
		return abstractActionProductoAceptar;
	}
	
	@Action
	public void actionCancelar() {
		frameProductoBusquedaInstancia.setVisible(false);
	}
	
    /**
    * Returns the action map used by this application.
     * Actions defined using the Action annotation
     * are returned by this method
     */
	private ApplicationActionMap getAppActionMap() {
		return Application.getInstance().getContext().getActionMap(this);
	}

}
